home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 9,300 to 9,399
/
9300.zip
/
AOLDLs
/
HTML & Web Tools (MAC)
/
WEB_ WebDocBuilder1.0b1
/
WebDocBuilder1.0b1 Folder.sit
/
WebDocBuilder1.0b1 Folder
/
WebDocBuilder Text
< prev
next >
Wrap
Text File
|
1995-09-13
|
4KB
|
115 lines
-- Version History
-- 1.0d1 original version
-- 1.0d2 lazy preflight of the convertorScript, to avoid the memory requirements of PhotoFlash when converting
-- files that don╒t contain pictures
-- 1.0d3 name change to WebDocBuilder in preparation for release to net
-- fixed bug that was causing the preflight to be run each time
-- 1.0d4 change to use clip2gif
-- 1.0d5 bug fix, files on the desktop were not being converted properly
-- 1.0d6 bug fix, check for file names being too long
-- 1.0b1 same as 1.0d6, release version
script convertorScript
property have_preflighted : false
on convertPictToGif(doc)
if not have_preflighted then
preflight()
end if
-- gif_convertor
tell application "clip2gif"
save doc as GIF with interlacing
end tell
end convertPictToGif
on preflight()
-- gif_convertor_launch
launch application "clip2gif"
set have_preflighted to true
end preflight
end script
on doConvert(doc)
-- get some salient information about the file from the Finder
tell application "Finder"
set doc_parent to (container of doc) as string
set doc_name to name of doc
end tell
-- verify that the file has the .cwk extension
set name_valid to true
if length of doc_name < length of ".cwk" then
set name_valid to false
end if
if name_valid then
if text -1 through -4 of doc_name ¡ ".cwk" then
set name_valid to false
end if
end if
if name_valid then
if length of doc_name │ 31 then
set name_valid to false
end if
end if
if not name_valid then
display dialog "The document name is either too long or does not have the .cwk extension!" buttons "OK" default button "OK"
error -128
end if
-- get the base name
set basename to text 1 through -5 of doc_name
-- convert the basic document to HTML and SimpleText
tell application "ClarisWorks Office"
open doc
save document 1 in file (doc_parent & basename & ".html") using "WWW [HTML]"
save document 1 in file (doc_parent & basename) using "TeachText & SimpleText"
close document 1
end tell
-- change the file creator of the resulting documents
-- the text goes to SimpleText, the HTML goes to MacWeb
-- after that we can ignore it because the SimpleText format already contains the pictures
tell application "Finder"
set creator type of alias (doc_parent & basename) to "ttxt" -- text_creator
set creator type of alias (doc_parent & basename & ".html") to "MWEB" -- web_creator
end tell
-- convert each of the pictures from PICT to GIF
set done to false
set i to 1
repeat until done
tell application "Finder"
exists item (basename & i & ".pict") in alias doc_parent
end tell
if result then
tell application "Finder"
set name of alias (doc_parent & basename & i & ".pict") to (basename & i)
end tell
set pict_file to alias (doc_parent & basename & i)
tell convertorScript to convertPictToGif(pict_file)
set gif_file to alias ((pict_file as string) & ".gif")
tell application "Finder"
set creator type of gif_file to "JVWR"
delete pict_file
end tell
set i to i + 1
else
set done to true
end if
end repeat
-- all finished!
end doConvert
on open doc_list
launch application "ClarisWorks Office"
repeat with i in doc_list
doConvert(i)
end repeat
end open
on run
if false then
display dialog "WebDocBuilder" & return & return & ┬
"⌐1995 Quinn ╥The Eskimo!╙ <quinn@cs.uwa.edu.au>" buttons {"OK"} default button "OK"
else
doConvert(alias "SuperGrover:Documents:Web:GreatMoveFAQ.cwk")
end if
end run